import request from '@/utils/request'

// 查询BOM组件明细列表
export function listComponents(query) {
  return request({
    url: '/base-data-service/base/components/operations/list',
    method: 'get',
    params: query
  })
}

// 查询BOM组件明细详细
export function getComponents(componentId) {
  return request({
    url: '/base-data-service/base/components/' + componentId,
    method: 'get'
  })
}

// 新增BOM组件明细
export function addComponents(data) {
  return request({
    url: '/base-data-service/base/components',
    method: 'post',
    data: data
  })
}

// 修改BOM组件明细
export function updateComponents(data) {
  return request({
    url: '/base-data-service/base/components',
    method: 'put',
    data: data
  })
}

// 删除BOM组件明细
export function delComponents(componentId) {
  return request({
    url: '/base-data-service/base/components/' + componentId,
    method: 'delete'
  })
}

// 查需要物料
export function getMaterials(bomId, operationId) {
  return request({
    url: '/base-data-service/base/components/materials' ,
    method: 'get'
  })
}